function findByThreshold(inputFileName,i_min,i_max,outputFileName)

%% check for all input parameters
if (nargin ~=4)
    error('incorrect number of arguments');    
end

%% load image
struct = load_untouch_nii(inputFileName);
mat3D = struct.img;
for layer=1:size(mat3D,1);
    currImg = squeeze(mat3D(layer,:,:)); % get current layer 
    currImg = filter_treshold(currImg,i_min,i_max); %run threshold in image    
     mat3D(layer,:,:) = currImg; % put the thresholded image back into 3D matrix
end
struct.img = mat3D;
save_untouch_nii(struct,outputFileName);
disp('findByThresold --> FINISHED');
end





